<?php


/*
* Copyright (c) 2008-2016 vip.com, All Rights Reserved.
*
* Powered by com.vip.osp.osp-idlc-2.5.11.
*
*/

namespace com\vip\vipcard;

class SellDigitalCardReq {
	
	static $_TSPEC;
	public $requestId = null;
	public $merchant_code = null;
	public $cardNumber = null;
	public $faceMoney = null;
	public $count = null;
	public $userId = null;
	public $orderSn = null;
	public $isReturnActivateCode = null;
	public $channel = null;
	public $thirdPartyOrderSn = null;
	
	public function __construct($vals=null){
		
		if (!isset(self::$_TSPEC)){
			
			self::$_TSPEC = array(
			11 => array(
			'var' => 'requestId'
			),
			12 => array(
			'var' => 'merchant_code'
			),
			13 => array(
			'var' => 'cardNumber'
			),
			14 => array(
			'var' => 'faceMoney'
			),
			15 => array(
			'var' => 'count'
			),
			16 => array(
			'var' => 'userId'
			),
			17 => array(
			'var' => 'orderSn'
			),
			18 => array(
			'var' => 'isReturnActivateCode'
			),
			19 => array(
			'var' => 'channel'
			),
			20 => array(
			'var' => 'thirdPartyOrderSn'
			),
			
			);
			
		}
		
		if (is_array($vals)){
			
			
			if (isset($vals['requestId'])){
				
				$this->requestId = $vals['requestId'];
			}
			
			
			if (isset($vals['merchant_code'])){
				
				$this->merchant_code = $vals['merchant_code'];
			}
			
			
			if (isset($vals['cardNumber'])){
				
				$this->cardNumber = $vals['cardNumber'];
			}
			
			
			if (isset($vals['faceMoney'])){
				
				$this->faceMoney = $vals['faceMoney'];
			}
			
			
			if (isset($vals['count'])){
				
				$this->count = $vals['count'];
			}
			
			
			if (isset($vals['userId'])){
				
				$this->userId = $vals['userId'];
			}
			
			
			if (isset($vals['orderSn'])){
				
				$this->orderSn = $vals['orderSn'];
			}
			
			
			if (isset($vals['isReturnActivateCode'])){
				
				$this->isReturnActivateCode = $vals['isReturnActivateCode'];
			}
			
			
			if (isset($vals['channel'])){
				
				$this->channel = $vals['channel'];
			}
			
			
			if (isset($vals['thirdPartyOrderSn'])){
				
				$this->thirdPartyOrderSn = $vals['thirdPartyOrderSn'];
			}
			
			
		}
		
	}
	
	
	public function getName(){
		
		return 'SellDigitalCardReq';
	}
	
	public function read($input){
		
		$input->readStructBegin();
		while(true){
			
			$schemeField = $input->readFieldBegin();
			if ($schemeField == null) break;
			$needSkip = true;
			
			
			if ("requestId" == $schemeField){
				
				$needSkip = false;
				$input->readString($this->requestId);
				
			}
			
			
			
			
			if ("merchant_code" == $schemeField){
				
				$needSkip = false;
				$input->readString($this->merchant_code);
				
			}
			
			
			
			
			if ("cardNumber" == $schemeField){
				
				$needSkip = false;
				$input->readString($this->cardNumber);
				
			}
			
			
			
			
			if ("faceMoney" == $schemeField){
				
				$needSkip = false;
				$input->readString($this->faceMoney);
				
			}
			
			
			
			
			if ("count" == $schemeField){
				
				$needSkip = false;
				$input->readI32($this->count); 
				
			}
			
			
			
			
			if ("userId" == $schemeField){
				
				$needSkip = false;
				$input->readI64($this->userId); 
				
			}
			
			
			
			
			if ("orderSn" == $schemeField){
				
				$needSkip = false;
				$input->readString($this->orderSn);
				
			}
			
			
			
			
			if ("isReturnActivateCode" == $schemeField){
				
				$needSkip = false;
				$input->readBool($this->isReturnActivateCode);
				
			}
			
			
			
			
			if ("channel" == $schemeField){
				
				$needSkip = false;
				$input->readString($this->channel);
				
			}
			
			
			
			
			if ("thirdPartyOrderSn" == $schemeField){
				
				$needSkip = false;
				$input->readString($this->thirdPartyOrderSn);
				
			}
			
			
			
			if($needSkip){
				
				\Osp\Protocol\ProtocolUtil::skip($input);
			}
			
			$input->readFieldEnd();
		}
		
		$input->readStructEnd();
		
		
		
	}
	
	public function write($output){
		
		$xfer = 0;
		$xfer += $output->writeStructBegin();
		
		$xfer += $output->writeFieldBegin('requestId');
		$xfer += $output->writeString($this->requestId);
		
		$xfer += $output->writeFieldEnd();
		
		$xfer += $output->writeFieldBegin('merchant_code');
		$xfer += $output->writeString($this->merchant_code);
		
		$xfer += $output->writeFieldEnd();
		
		if($this->cardNumber !== null) {
			
			$xfer += $output->writeFieldBegin('cardNumber');
			$xfer += $output->writeString($this->cardNumber);
			
			$xfer += $output->writeFieldEnd();
		}
		
		
		if($this->faceMoney !== null) {
			
			$xfer += $output->writeFieldBegin('faceMoney');
			$xfer += $output->writeString($this->faceMoney);
			
			$xfer += $output->writeFieldEnd();
		}
		
		
		if($this->count !== null) {
			
			$xfer += $output->writeFieldBegin('count');
			$xfer += $output->writeI32($this->count);
			
			$xfer += $output->writeFieldEnd();
		}
		
		
		if($this->userId !== null) {
			
			$xfer += $output->writeFieldBegin('userId');
			$xfer += $output->writeI64($this->userId);
			
			$xfer += $output->writeFieldEnd();
		}
		
		
		if($this->orderSn !== null) {
			
			$xfer += $output->writeFieldBegin('orderSn');
			$xfer += $output->writeString($this->orderSn);
			
			$xfer += $output->writeFieldEnd();
		}
		
		
		if($this->isReturnActivateCode !== null) {
			
			$xfer += $output->writeFieldBegin('isReturnActivateCode');
			$xfer += $output->writeBool($this->isReturnActivateCode);
			
			$xfer += $output->writeFieldEnd();
		}
		
		
		$xfer += $output->writeFieldBegin('channel');
		$xfer += $output->writeString($this->channel);
		
		$xfer += $output->writeFieldEnd();
		
		if($this->thirdPartyOrderSn !== null) {
			
			$xfer += $output->writeFieldBegin('thirdPartyOrderSn');
			$xfer += $output->writeString($this->thirdPartyOrderSn);
			
			$xfer += $output->writeFieldEnd();
		}
		
		
		$xfer += $output->writeFieldStop();
		$xfer += $output->writeStructEnd();
		return $xfer;
	}
	
}

?>